package Day;

import java.util.Scanner;

public class Day2 {
    //牛牛的快递
    public static void main1(String[] args) {
        Scanner in=new Scanner(System.in);
        double x=in.nextDouble();
        char n=in.next().charAt(0);
        if(x<=1){
            if(n=='y'){
                System.out.println(20+5);
            } else {
                System.out.println(20);
            }
        }else{
            int t=(int)Math.ceil(x-1);
            int a=20+t;
            if(n=='y'){
                System.out.println(a+5);
            } else {
                System.out.println(a);
            }
        }
    }

    public static void main2(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        if(n==1||n==0)System.out.println(0);
        if(n==2)System.out.println(1);
        int []num=new int[n];
        for(int i=0;i<n;i++){
            num[i]=in.nextInt();
        }
        int []dp=new int[n+1];
        for(int i=2;i<n;i++){
            dp[i]=Math.min(dp[i-1]+num[i-1],dp[i-2]+num[i-2]);
        }
        System.out.println(dp[n]);
    }

    public static void main(String[]args){

    }

    //乘积为正数的最长子数组长度
    public int getMaxLen(int[] nums) {
        int n=nums.length;
        int []f=new int [n+1];
        int []g=new int[n+1];
        int ret=0;
        for(int i=1;i<=n;i++){
            if(nums[i-1]>0){
                f[i]=f[i-1]+1;
                g[i]=g[i-1]==0?0:g[i-1]+1;
            }else if(nums[i-1]<0){
                f[i]=g[i-1]==0?0:g[i-1]+1;
                g[i]=f[i-1]+1;
            }
            ret=Math.max(ret,f[i]);
        }
        return ret;
    }

    //等差数列划分
    public int numberOfArithmeticSlices(int[] nums) {
        int n=nums.length;
        int []dp=new int[n];
        if(n<3)return 0;
        int sum=0;
        for(int i=2;i<n;i++){
            if(nums[i]-nums[i-1]==nums[i-1]-nums[i-2])dp[i]=dp[i-1]+1;
            else dp[i]=0;
            sum+=dp[i];
        }
        return sum;
    }

    //最长湍流数组
    public int maxTurbulenceSize(int[] arr) {
        int n=arr.length;
        int []f=new int[n];
        int []g=new int[n];
        for(int i=0;i<n;i++)g[i]=f[i]=1;
        int ret=1;
        for(int i=1;i<n;i++){
            if(arr[i]>arr[i-1])f[i]=g[i-1]+1;
            else if(arr[i]<arr[i-1])g[i]=f[i-1]+1;
            ret=Math.max(Math.max(f[i],g[i]),ret);
        }

        return ret;
    }

}
